package com.thoughtworks.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class ReadFileUtil {
	public static String getFileContent(String input_file) throws IOException {
		File file = new File(input_file);
		if(!file.isFile() || !file.exists()) {
			throw new FileNotFoundException();
		}
		InputStreamReader in = new InputStreamReader(new FileInputStream(file));
		BufferedReader bufferedReader = new BufferedReader(in);
		StringBuffer content = new StringBuffer();
		String line = null;
		try {
			while((line = bufferedReader.readLine()) != null) {
				content.append(line).append("\n");
			}
		} finally {
			bufferedReader.close();
		}
		return content.toString();
	}
}
